<?php

namespace App\Policies;

use App\Models\AdminUser;
use App\PlantVariety;
use Illuminate\Auth\Access\HandlesAuthorization;

class PlantVarietyPolicy
{
    use HandlesAuthorization;

    public function edit(AdminUser $user, PlantVariety $model)
    {
        return $user->role_typ == 1 || ($model['user_id'] == $user->id && $model['review_status'] != 1);
    }

    public function update(AdminUser $user, PlantVariety $model)
    {
        return $user->role_typ == 1 || ($model['user_id'] == $user->id && $model['review_status'] != 1);
    }

    public function delete(AdminUser $user, PlantVariety $model)
    {
        return $user->role_typ == 1 || ($model['user_id'] == $user->id && $model['review_status'] != 1);
    }
}
